import { Service } from "egg";


export default class LuckyService extends Service {

  async list(page = 1, pageSize = 10) {
    const queryParams = {
      // where: deleteNullOrUndefinedField(query),
      offset: (Number(page) - 1) * pageSize,
      limit: pageSize,
      distinct: true,

      order: [['id', 'DESC']],
    };

    const result = await this.ctx.model.LuckyDef.findAndCountAll(queryParams);

    return {
      list: result.rows,
      total: result?.count || 0,
      page,
      pageSize,
    }
  }
}